package com.qinglei.recoup.app.controller;

import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.qinglei.recoup.common.domain.CommonRes;
import com.qinglei.recoup.common.utils.RecoupUtil;
import com.qinglei.recoup.system.domain.User;
import com.qinglei.recoup.system.service.BedService;
import com.qinglei.recoup.system.service.UserService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.time.LocalDate;

@RestController
@RequestMapping("/weixin")
public class AppUserController {
    @Resource
    private UserService userService;


    @PostMapping("addBirthday")
    public CommonRes addBirthday(@RequestBody User user){
        UpdateWrapper updateUser = new UpdateWrapper();
        updateUser.eq("id",RecoupUtil.getCurrentUser().getId());
        updateUser.set("birthday",user.getBirthday());
        if(userService.update(updateUser)){
            return  CommonRes.ok("success");
        }else {
            return  CommonRes.failed("failed");
        }
    }



}
